Skip to content

修复会话标题按钮回主列时页面丢失的问题,并修正 dsh-doca 插件文档 - #203

Merged
vchive merged 2 commits into
mainfrom
claude/dsh-doca-docs-refresh
Dec 4, 2026
Merged

vchive merged 2 commits into
mainfrom
claude/dsh-doca-docs-refresh

Conversation

@vchive

@vchive vchive commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

SDD-Level: light
SDD-Spec: none

Problem

两件事,都在 @smartdoca/dsh-doca 插件里。

1. 一个代码缺陷。 站点视图在中间主列和右侧栏之间切换时应当保留当前打开的页面(spec 023 记录两个方向都已实测)。但用会话标题旁的 Doca 按钮把站点从右侧栏移回主列时页面不跟着走:主列重新打开的是它上次自己显示的页面(通常是文档列表),右侧栏当时正在看的那篇文档被留在右侧栏。用右侧栏标签页头部的“在中间打开”则正常。

原因是一行漏写。主列和右侧栏各自记着当前页面(panelUrl、homeTabUrl)。主列→右侧栏(hostInSidebar)和标签页头部按钮(openInPanel)都有“把对方的状态赋过来”这一步;会话标题旁按钮的那个分支只切换了面板,没有赋值。

这个缺陷此前没有测试能发现:现有测试走过这条路径,但只断言“主列被打开”,没有断言“主列显示哪一页”。

2. 文档过时。 README 和冒烟清单(SMOKE)最后一次修改是 2026-11-29,此后插件代码(11-30 加了刷新按钮)和被嵌入的 Doca 网页应用都变过,文档没有跟上。

Behavior

代码修复(integrations/dsh-doca/client/index.ts,1 行): 会话标题旁按钮的“右侧栏→主列”分支补上 if (homeTabUrl !== undefined) panelUrl = withNarrowMarker(panelSite, homeTabUrl),与标签页头部按钮的做法完全一致。只有站点自己的页面才会更新 homeTabUrl(空白引导页和站外地址都被过滤),所以带过来的地址始终是站点内的页面。

回归测试(integrations/dsh-doca/test/client.test.ts): 右侧栏显示某篇文档时点会话标题旁的按钮,断言主列拿到的是这篇文档并带窄版式标记。去掉修复该断言失败(主列拿到的是 #/documents),恢复修复后通过。

文档(README + SMOKE,中英各一份,4 个文件)。 每条陈述对照代码核实,报告出的问题再由另一个读者复核(确认 18 条、否决 4 条)。最终内容:

新增(此前完全没写):

  • 站点里的复制受限(加进“已知限制”)。DSH 拒绝嵌入页面使用剪贴板接口。站点运行 Doca 0.3.6 及以上时,表格里的复制、剪切,以及表格打开期间“分享”对话框的复制链接可用;更旧的 Doca 上弹“无法访问剪贴板”且复制不到内容;复制图片和其它页面上的复制按钮在任何版本上都失败。
  • 刷新按钮。两处站点视图的头部都有,用来载入视图开着时服务器上更新过的站点。
  • 确认模式 none:该模式下创建/移动/删除不再弹卡片,但申请文档阅读权限、通过 Doca 发出的 HTTP 请求、插件不认识的操作在任何模式下都会确认。
  • 文件传输的 20 MiB 上限,以及不指定路径时的默认下载目录 doca-downloads。

修正(原文与代码不符):

  • 会话标题旁按钮“上次显示在哪就打开另一处”的记住规则表述不准;从开始面板打开的标签页不会被记住。
  • 从中间主列打开站点附件时,对话会先回来,原文没提。
  • “+ 添加站点”不是空表单:已连接站点时会预填当前站点的地址和登录信息。
  • 当前这一行没有 ✕(不能删除当前站点),原文没说。
  • MCP 密钥胶囊在窄的右侧栏里不显示,原文没说。
  • “插件配置只保存站点地址和引用名”不准确:不含凭据,但还有确认模式等其它设置。
  • 开始面板里的入口叫“Doca 文档”,打开的标签页才叫“Doca”。
  • 手写的 DSH 类型不止在 src/dsh-types.ts 一处。
  • 紧凑版式从 Doca 0.3.2 起提供,补上了版本号。

冒烟清单: 第 7 项改成能照着执行的步骤,并且明确走会话标题旁的按钮这条路径(即本次修复的路径);新增 7a 检查刷新按钮;英文版“活动记录”控件补上英文名 Activity;“未覆盖”清单加上表格复制。

Impacts

  • 定级理由:light。 一是有界的缺陷修复,恢复 spec 023 已记录的行为,不改任何契约或高风险边界;二是纯文档改动。不涉及数据库、鉴权、协作、公开 SDK/API 或架构边界。改动量:代码 1 行(另有 3 行注释),测试 +9 行,文档 4 个文件。
  • 契约: 无涉及。docs/ 下的契约文档未改动,@smartdoca/dsh-doca 的公开接口(注册的槽位、注入对象、IPC)没有变化。
  • 兼容性决定:无。 没有读写、转换或迁移任何持久化数据;homeTabUrl 和 panelUrl 都是插件运行时的内存变量。
  • 是否需要发新版插件: 是。修复要在插件发新版并安装后才在 DSH 里生效;当前已安装的 dev.65 不含它。本 PR 不发版。

Verification

  • 回归测试先失败后通过: 加上断言后、修复前运行,失败于 expected '#/documents…' to be '#/r/sidebar-doc…';加上修复后通过。随后临时去掉修复那一行重跑,再次失败于同一处;恢复后通过。
  • pnpm check:dsh-doca 退出码 0:类型检查(3 个程序)、312 个测试通过 / 5 个按环境跳过、构建成功。
  • pnpm docs:check、pnpm sdd:check 退出码 0(基线为 main 0bfe5f6、Doca 0.3.9)。
  • 两个语言版本逐行对应:README 各 89 行、SMOKE 各 56 行,“已知限制”各 7 条逐条对应。
  • 文档里引用的每个界面文字都对照插件的语言包核实过。
  • 版本事实逐个核对过 git:剪贴板兜底在 0.3.5 的发布提交(e68a994)里不存在,在 0.3.6(63cb599)、0.3.7(daf8878)及之后都有;紧凑版式路由在 0.3.2 的发布提交里首次出现。

没有做的:

  • 没有在真实的 DSH 里点过这个修复。 证据只有单元测试——它证明主列拿到了正确的地址,不证明真实应用里点按钮后页面确实显示出来。要实测需要重装插件并重启 DSH。
  • 没有按新的冒烟清单人工走过一遍,步骤是照代码写的。

顺带发现、未在本次处理

  • 两个没人读的配置项: interfaceEnabled 和 showGuideEntry 在 src/config.ts 里声明并显示在 DSH 设置里,但没有任何代码读取它们。
  • 一处设置说明不准确: 确认模式 none 的设置说明写的是“不确认”,但申请权限等三类操作在该模式下仍会确认(文档已按实际行为写明,设置里的说明文字未改)。

🤖 Generated with Claude Code

vchive and others added 2 commits December 4, 2026 11:39
The README and the smoke checklist were last changed on 2026-11-29; the
plugin and the embedded web app moved on since. Every statement was checked
against the code and each finding verified by a second reader.

What was wrong or missing, now corrected in both editions:

- Copying inside the embedded site was not mentioned. DSH denies embedded
  pages the Clipboard API; from Doca 0.3.6 copy and cut in a spreadsheet and
  the share dialog's copy-link work through the browser's older copy path,
  older sites show the sheet's warning, and image copy and the copy buttons
  of other pages fail on every version.
- The reload button of both site views (added on 2026-11-30) was undocumented.
- The page does not follow the conversation-title button back to the main
  column; only the tab header's "Open in the main view" carries it. The text
  said switching keeps the page in both directions, which spec 023 records
  as verified. The docs now describe the behaviour as it is and list it as a
  known limitation.
- Which entries are remembered when the title button chooses where to open,
  and that a Start-pane tab is not.
- From the main column, opening an attachment also brings the conversation back.
- The confirmation mode `none`, and the three classes confirmed in every mode.
- The 20 MiB transfer limit and the default download directory.
- The MCP key pill is hidden in a narrow sidebar; the current row has no delete;
  the add form opens prefilled; the config row holds more than the address and
  a reference name; the first release with the narrow layout is 0.3.2.
- The hand-written DSH types live in more than one file.

The smoke checklist gains a reload step, names the Activity control by its
English label, and states that item 7 returns through the tab header.

Co-Authored-By: Claude Code <noreply@anthropic.com>
…le button

The site view hands its page over when the site moves from the main column
to the sidebar, and the sidebar tab header's own button brings the page back.
The conversation-title button did not: returning the site from the sidebar to
the main column only selected the panel, so the column reopened on the page
it last showed itself and the document the sidebar had moved on to was left
behind. Spec 023 records both directions as keeping the page.

The button now copies the sidebar's page into the column's, with the narrow
marker added again, exactly as the tab header's button does. The regression
test fails on the previous code and passes with this one; it had no
assertion on which page the column shows before.

With the behaviour restored, the README and the smoke checklist describe the
switch as keeping the page in both directions again, and item 7 of the
checklist walks the title button as well as the tab header's button.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@vchive vchive changed the title 修正 dsh-doca 插件文档中过时和缺失的内容 修复会话标题按钮回主列时页面丢失的问题,并修正 dsh-doca 插件文档 Dec 4, 2026
@vchive
vchive merged commit 939e3fb into main Dec 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant